package cn.cdiothree.vo;


import lombok.Data;

@Data
public class NewsResultVO {

    private Integer newscode;
    private String newsmsg;
    private Object newsdata;

    public static NewsResultVO success(Object object) {
        NewsResultVO newsResultVO = new NewsResultVO();
        newsResultVO.setNewscode(0);
        newsResultVO.setNewsmsg("成功");
        newsResultVO.setNewsdata(object);
        return newsResultVO;
    }

    public static NewsResultVO success(Object object,String msg) {
        NewsResultVO newsResultVO = new NewsResultVO();
        newsResultVO.setNewscode(0);
        newsResultVO.setNewsmsg(msg);
        newsResultVO.setNewsdata(object);
        return newsResultVO;
    }

    public static NewsResultVO success(Integer code, String msg) {
        NewsResultVO newsResultVO = new NewsResultVO();
        newsResultVO.setNewscode(code);
        newsResultVO.setNewsmsg(msg);
        return newsResultVO;
    }

    public static NewsResultVO success() {
        return success(null);
    }

    public static NewsResultVO error(Integer code, String msg) {
        NewsResultVO newsResultVO = new NewsResultVO();
        newsResultVO.setNewscode(code);
        newsResultVO.setNewsmsg(msg);
        return newsResultVO;
    }


    public static ResultVO error(Object object) {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(1);
        resultVO.setMsg("出错就返回这种");
        resultVO.setData(object);
        return resultVO;
    }
}
